﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _404park.ApplicationServices.SearchProvider
{
    public class SelfHostedGoogleSearchProvider : ISearchProvider
    {
        public static readonly string GoogleCSEId = ConfigurationManager.AppSettings["GoogleCSEId"];
        public static readonly string GoogleAPIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];
        public static readonly string GoogleCSEUrl = ConfigurationManager.AppSettings["GoogleCSEUrl"];
        public static readonly string SelftHostedUrl = ConfigurationManager.AppSettings["selftHostedGoogleSearchResultUrl"];

        public SelfHostedGoogleSearchProvider() : this(30)
        {
        }

        public SelfHostedGoogleSearchProvider(int percentage)
        {
            Percentage = percentage;
        }

        public string BaseUrl
        {
            get { return SelftHostedUrl; }
        }

        public int Percentage { get;set; }

        public string Name { get { return "SelftHostedGoogle"; } }

        public string BuildNavigateUrl(string keywords)
        {
            return string.Format(BaseUrl, AppGlobal.AppHost, keywords);
        }
    }
}
